|
|
|
|
|
|
|
CRTError:
WriteErrMsg "CRT-Error " & Err & ": " & Error
End
Exit Sub
End Sub
Sub CreateLocalFile()
'This procedure creates the MDB file itself
Dim MainTable() As New TableDef
Dim sTemp As String
Dim nTables As Integer
Dim nCurTable As Integer
Dim sSQLTable As String
Dim sMDBTable As String
Dim sSection As String
On Error GoTo CRLError
If bFileExists(sDBLocalPath) Then Kill sDBLocalPath
Set dbLocal = CreateDatabase(sDBLocalPath, dbLangGeneral)
nTables = CInt(sGetINIString(sINIPath, "Tables", "Tables", "0"))
ReDim MainTable(1 To nTables)
For nCurTable = 1 To nTables
sSQLTable = sGetINIString(sINIPath, "tables", "table" & nCurTable & _
"SQL", "none")
sMDBTable = sGetINIString(sINIPath, "tables", "table" & nCurTable & _
"MDB", "none")
sSection = sGetINIString(sINIPath, "tables", "table" & nCurTable & _
"INI", "none")
CreateTable MainTable(nCurTable), sMDBTable, sSection
dbLocal.TableDefs.Append MainTable(nCurTable)
Next nCurTable
Exit Sub
CRLError:
WriteErrMsg "CRL-Error " & Err & ": " & Error
End
Exit Sub
End Sub
Private Sub WriteErrMsg(sMessage As String)
'Should an error occur, this function writes it to
'another INI file. I did it this way because the
'program runs as a scheduled process on a remote
'machine, so no one would be there to answer an error
'dialog. There is a second VB program that continuously
'checks the Error.ini file and pages me with the error message.
Dim sErrorINI As String
sErrorINI = sGetINIString(sINIPath, "General", "ErrorINI", "error.ini")
writeINIString sErrorINI, "Error", "Message", sMessage
writeINIString sErrorINI, "Error", "Error", "True"
End Sub |
|
|
|
|
|